<script>
	function selectMaterialInfo(index,row) {
		$('#orderItemUnitName').val(row.unitName);
		$('#orderItemMaterialName').val(row.name);
		$('#orderItemMaterialCode').val(row.code);
		$('#orderItemSpec').val(row.spec);
		//设置默认报价
		$('#orderItemUnitPrice').numberbox('setValue',row.standardPrice);
		//
		
		calculateAmount();
	}
	
	function calculateAmount() {
		var afterCalculate = Number($('#orderItemCountNum').numberbox('getValue'))*Number($('#orderItemUnitPrice').numberbox('getValue'));
		$('#orderItemTotalAmount').numberbox('setValue', afterCalculate.toFixed(2));
	}
	
	function selectProjectInfo(data) {
		$('#orderItemProjectName').val(data.name);
	}
	
// 	$('#'+id).numberbox('setValue', value);
	//freight premium agencyHandSum arrivalSum receiveSum
	
</script>
<form id="orderItemForm">
<table cellpadding="5">
	<input name="id" type="hidden" value="${(orderItemItem.id)!}" />
<!-- 	<tr> -->
<!-- 		<td class="tbLabel">项目ID:</td> -->
<!-- 		<td> -->
<!-- 			<input name="projectId" style="width:158px;" class="easyui-numberbox"  precision="0" data-options="required: false" value="${(orderItemItem.projectId)!}" /> -->
<!-- 		</td> -->
<!-- 	</tr> -->
	<tr>
<!-- 		<td class="tbLabel">项目名称:</td> -->
<!-- 		<td> -->
<!-- 			<@eu.comboBox onSelect="selectProjectInfo(value)" url="project.do?loadProjectComboBox&value=${(orderItemItem.projectId)!}" required="true" name="projectId"/> -->
<!-- 			<input id="orderItemProjectName" name="projectName"  type="hidden" value="${(orderItemItem.projectName)!}"/> -->
<!-- 		</td> -->
		<td class="tbLabel">商品名称:</td>
		<td>
			<@eu.combogrid id="orderItemSelectMaterial" onSelect="selectMaterialInfo(index,row)"
				idField="id" textField="name" name="materialId"
				url="material.do?loadComboGrid" item="com.xdtech.ad.vo.MaterialItem"
				values="${(orderItemItem.materialId)!}"/> 
			<input id="orderItemMaterialName" name="materialName" type="hidden" value="${(orderItemItem.materialName)!}"/>
		</td>
		<td class="tbLabel">商品编码:</td>
		<td>
			<input id="orderItemMaterialCode" name="materialCode" readonly="readonly" class="easyui-validatebox textbox" data-options="required: false" value="${(orderItemItem.materialCode)!}"/>
		</td>
	</tr>
<!-- 	<tr> -->
<!-- 		<td class="tbLabel">耗材ID:</td> -->
<!-- 		<td> -->
<!-- 			<input name="materialId" style="width:158px;" class="easyui-numberbox"  precision="0" data-options="required: false" value="${(orderItemItem.materialId)!}" /> -->
<!-- 		</td> -->
<!-- 	</tr> -->
	<tr>
<!-- 		<td class="tbLabel">制作内容:</td> -->
<!-- 		<td> -->
<!-- 			<input name="doContent"  class="easyui-validatebox textbox" data-options="required: false" value="${(orderItemItem.doContent)!}"/> -->
<!-- 		</td> -->
		<td class="tbLabel">单位:</td>
		<td>
			<input id="orderItemUnitName" name="unitName" readonly="readonly"  class="easyui-validatebox textbox" data-options="required: false" value="${(orderItemItem.unitName)!}"/>
		</td>
		<td class="tbLabel">数量:</td>
		<td>
			<input id="orderItemCountNum" name="countNum" style="width:158px;" class="easyui-numberbox" precision="0" data-options="required: false,onChange:function(newValue,oldValue) {calculateAmount();}" value="${(orderItemItem.countNum)!0}"/>
		</td>
	</tr>
	<tr>
		<td class="tbLabel">单价:</td>
		<td>
			<input id="orderItemUnitPrice" name="unitPrice" style="width:158px;" class="easyui-numberbox"  precision="2" data-options="required: false,onChange:function(newValue,oldValue) {calculateAmount();}" value="${(orderItemItem.unitPrice)!}"/>
		</td>
		<td class="tbLabel">金额:</td>
		<td>
			<input id="orderItemTotalAmount" name="totalAmount" readonly="readonly" style="width:158px;" class="easyui-numberbox"  precision="2" data-options="required: false" value="${(orderItemItem.totalAmount)!}"/>
		</td>
	</tr>
	<tr>
		<td class="tbLabel">商品规格:</td>
		<td>
			<input id="orderItemSpec" name="spec" readonly="readonly"  class="easyui-validatebox textbox" data-options="required: false" value="${(orderItemItem.spec)!}"/>
		</td>
	</tr>
	<tr>
		<td class="tbLabel">备注:</td>
		<td colspan="3">
			<textarea style="height: 50px;width: 418px;" rows="6"  name="remark" class="easyui-validatebox textbox">${(orderItemItem.remark)!}</textarea>
		</td>
	</tr>
</table>
</form>
